x86/traps: improve hypervisor stack overflow detection
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 15 Feb 2016 13:14:43 +0000 (14:14 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 15 Feb 2016 13:14:43 +0000 (14:14 +0100)
commit2c56cda8bc596b5073d0fd602e6069f768640ac1
tree16f7daf4fb5e03d9c0d9adb831e11a3b9263f84f
parent557c7873f35aa39bd84977b28948457b1b342f92
x86/traps: improve hypervisor stack overflow detection

A sample Gentoo compliation of Xen contains

    lea    -0x1058(%rsp),%rsp
    orq    $0x0,(%rsp)
    lea    0x1020(%rsp),%rsp

Whatever the reason for silly code like this, it fools the current stack
overflow detection logic in the #DF handler (which triggers reliably on the
'orq' instruction).

Update the overflow condition to declare an overflow if %esp is anywhere
within the guard page, rather than just within the upper 8th of the page.

Additionally, check %esp against the expected stack base in all builds.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/traps.c